"""
设计一个函数，返回传入的列表中的最大值和第二大值的元素

Version: 0.1
Author: yuwl
Date：2024-3-19
"""

def max2(x):
    m1, m2 = (x[0], x[1]) if x[0] > x[1] else (x[1], x[0])
    for index in range(2, len(x)):
        if(x[index] > m1):
            m2 = m1
            m1 = x[index]
        elif(x[index] > m2):
            m2 = x[index]
    return m1, m2

print(max2([1,7,3,6]))